<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/12 0012
 * Time: 下午 4:16
 */
header("Content-Type: application/json;charset=utf-8");
//header("Access-Control-Allow-Origin:*");

if(isset($_REQUEST["gid"])){
    $str= file_get_contents("./data/goodsData.json");
    //1.把字符串转 对象
    $listArr=json_decode($str);

    //2.遍历对象
    foreach ($listArr as $item){
        if($item->gid==$_REQUEST["gid"]){
            print_r(json_encode($item));
            return;
        }
    }

}